package com.wangshuo.testspringboot.Controller;

import com.wangshuo.testspringboot.Mapper.UserMapper;
import com.wangshuo.testspringboot.Service.UserService;
import com.wangshuo.testspringboot.entity.User;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {
    @Resource
    private UserMapper userMapper;
@Resource
private UserService userService;
    @RequestMapping("/list")
    public List<User> list(){
        return userMapper.selectList(null);
    }
    @RequestMapping("/add")
    public void add(@RequestBody User user){
        userService.save(user);

    }

}
